// API接口汇总
import instance from './request.js';
import layout from "@/layout/Index";


export let user = {
    userGet(params = {}){ // params为查询参数 page, name 等等
        return instance.get(`/user/`, { params })
    },
    userAdd(data){
        return instance.post('/user/',data)
    },
}
export const login = {
    logout(){
        return instance.delete('/logout/')
    }
}

export function getQueryPermission() {
}

export const getRoutes = function (){
    return [
        //  首页
        {
            path: '/',
            visible: false,
            redirect:'/login'
        },
        //  首页
        {
            path: '/home',
            visible: true,
            component: layout,
            meta: {
                title: '首页',
                icon: 'mdi-gauge',
                keepAlive: false
            },
            children: [
                {
                    path: '',
                    name: 'home',
                    meta: {
                        title: '首页',
                        icon: 'mdi-gauge',
                        keepAlive: false
                    },
                    component:()=>import('@/views/home/Index')
                },
            ]
        },
//    测试
        {
            path: '/test',
            visible: true,
            redirect: '/test/index',
            component: layout,
            meta: {
                title: '测试',
                icon: 'mdi-view-comfy',
                keepAlive: false
            },
            children:[
                {
                    path: 'index',
                    name: 'testIndex',
                    meta: {
                        title: '测试首页',
                        icon: 'mdi-alpha-w',
                        keepAlive: false
                    },
                    component: () => import('@/views/test/Index')
                },
                {
                    path: 'hello',
                    name: 'testHello',
                    meta: {
                        title: 'hello',
                        icon: 'mdi-alpha-w',
                        keepAlive: false
                    },
                    component: () => import('@/views/test/hello')
                },
            ]
        },
        //    登录
        {
            path:'/login',
            name:'login',
            visible: true,
            meta: {
                title: '登录',
                icon: 'mdi-fingerprint',
                keepAlive: false
            },
            component:()=>import('@/views/login/Index')
        },
    ]
        ;
}
